- @title = @group.name

- content_for :sub_title do
  = render partial: 'join_buttons'

- map_header(@group)

- if not @group.approved
  .alert.alert-warning.alert-dismissable
    = icon 'fa fa-warning'
    %button{ type: 'button', class: 'close', 'data-dismiss' => 'alert', 'aria-hidden' => 'true'} ×
    %p
      = t('groups.pending_approval.this_group')
    - if @logged_in.admin?(:manage_groups)
      %p
        = form_for @group do |form|
          = form.hidden_field 'approved', value: true
          = form.button t('groups.approve.button'), class: 'btn btn-success'

- if @group.private?
  .callout.callout-warning
    = t('groups.private.callout')

- if @group.hidden?
  .callout.callout-danger
    = t('groups.hidden.callout')
.row
  .col-sm-6.col-sm-push-6

    .row
      - if @group.email?
        = group_content_column do
          .small-box.bg-aqua
            - if @member_of
              = link_to group_messages_path(@group) do
                .inner
                  %h3= @group.messages.count
                  %p= t('groups.box.messages.text', count: @group.messages.count)
            - else
              .inner
                %h3= @group.messages.count
                %p= t('groups.box.messages.text', count: @group.messages.count)
            %div{ class: @member_of ? 'icon' : 'icon-disabled' }
              = icon 'fa fa-envelope-o'
            - if @group.can_send?(@logged_in)
              = link_to new_group_message_path(@group), class: 'small-box-footer' do
                = t('groups.box.messages.new_link')
                = icon 'fa fa-plus-circle'
      - if @group.prayer?
        = group_content_column do
          .small-box.bg-purple
            - if @member_of
              = link_to group_prayer_requests_path(@group) do
                .inner
                  %h3= @group.prayer_requests.count
                  %p= t('groups.box.prayer_requests.text', count: @group.prayer_requests.count)
            - else
              .inner
                %h3= @group.prayer_requests.count
                %p= t('groups.box.prayer_requests.text', count: @group.prayer_requests.count)
            %div{ class: @member_of ? 'icon' : 'icon-disabled' }
              = icon 'fa fa-heart-o'
            - if @group.can_add_prayer_request?(@logged_in)
              = link_to new_group_prayer_request_path(@group), class: 'small-box-footer' do
                = t('groups.box.prayer_requests.new_link')
                = icon 'fa fa-plus-circle'
      - if @group.pictures?
        = group_content_column do
          .small-box.bg-orange
            = link_to group_albums_path(@group) do
              .inner
                %h3= @pictures.count
                %p= t('groups.box.pictures.text', count: @pictures.count)
            .icon
              = icon 'fa fa-picture-o'
            - if @group.can_add_album?(@logged_in)
              = link_to new_group_album_path(@group), class: 'small-box-footer' do
                = t('groups.box.pictures.new_link')
                = icon 'fa fa-plus-circle'
      - if @group.has_tasks?
        = group_content_column do
          .small-box.bg-teal
            = link_to group_tasks_path(@group) do
              .inner
                %h3= @tasks.count
                %p= t('groups.box.tasks.text', count: @tasks.count)
            .icon
              = icon 'fa fa-check-square-o'
            - if @group.can_add_task?(@logged_in)
              = link_to new_group_task_path(@group), class: 'small-box-footer' do
                = t('groups.box.tasks.new_link')
                = icon 'fa fa-plus-circle'


    .group-avatar
      = group_avatar_tag(@group, size: :large)

    - if @member_of
      = render partial: 'description'
      = render partial: 'details'

  .col-sm-6.col-sm-pull-6
    - if @member_of
      - if content = timeline(@stream_items)
        = content
      - else
        .alert.alert-info.alert-dismissable
          = icon 'fa fa-comments'
          %button.close{ 'aria-hidden' => 'true', 'data-dismiss' => 'alert', 'type' => 'button' } ×
          %strong= t('groups.stream.none.heading')
          = t('groups.stream.none.message')
    - else
      = render partial: 'description'
      = render partial: 'details'

